<template>
	<view class="current_team">
		<view class="past" v-if="activeTab==1 && list.length>0">
			<view class="item" v-for="(item,index) in list" :key="index">
				<view>
					<text>班组名称：</text>
					<text>{{item.name}}</text>
				</view>
				<view>
					<text>班组长：</text>
					<text>{{item.leader}}</text>
				</view>
				<view class="type">
					<view>
						<text>时间：</text>
						<text>{{item.begin_date}} ~ {{item.end_date}}</text>
					</view>
				</view>
			</view>
			<image v-if="list.length<1"
				style="position: absolute;top:0;left: 0;bottom: 0;right: 0;margin: auto;width: 600rpx;"
				src="../../../static/image/no-data.png" mode=""></image>
		</view>
	</view>
</template>

<script>
	import uniTabs from '../../../components/v-tabs/v-tabs.vue'
	import api from '@/static/js/api.js'
	export default {
		data() {
			return {
				tabs: [
					// '当前班组',
					'往期班组'
				],
				activeTab: 1,
				list: [],
				userinfo: []
			}
		},
		components: {
			uniTabs
		},
		onShow() {
			this.userinfo = JSON.parse(uni.getStorageSync('userInfo'));
			this.workerClass()
		},
		methods: {
			// change(index) {
			// 	this.activeTab = index
			// }
			workerClass() {
				api.workerClass('res.partner', '_api_home_worker_list', this.userinfo.access_token, this.userinfo.uid)
					.then(res => {
						this.list = res.data.team_list
					}).catch(e => {
						uni.showToast({
							icon: 'none',
							title: e.message
						})
					})
			}
		}
	}
</script>

<style lang="less" scoped>
	.current_team {
		height: 100vh;
		background-color: #EBEEF5;

		.current {
			.item {
				margin-top: 10rpx;
				background: #fff;
				padding: 20rpx 20rpx;

				// & view:not(:first-child) {
				// 	margin-left: 20rpx;
				// }

				>view {
					height: 50rpx;
					display: flex;
					justify-content: space-between;
					margin-left: 20rpx;
				}

				.banzu {
					width: 34rpx;
					height: 34rpx;
				}

				.team_information {
					color: #D65964;
					font-size: 30rpx;
				}
			}

			.c_item {
				// color: #7B7B7B;
			}
		}

		.past {

			.item {
				color: #7B7B7B;
				margin-top: 10rpx;
				padding: 20rpx 20rpx;
				background: #fff;

				>view {
					height: 50rpx;
					display: flex;
					align-items: center;
				}

				.type {
					display: flex;
					justify-content: space-between;

					.types {
						background: #4397EA;
						padding: 0 30rpx;
						color: #fff;
					}
				}
			}
		}
	}

	.tabs {
		position: relative;
	}

	/deep/ .v-tabs {
		width: 100%;
		height: 100rpx;
		background-color: #FFFFFF;
		line-height: 100rpx;
	}

	/deep/ .v-tabs__container-item {
		width: 100%;
		justify-content: center;
	}
</style>
